home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4988 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What does the -O option do???!!!
  5. Date: 10 Feb 1996 10:52:43 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4fiphrINNrvr@keats.ugrad.cs.ubc.ca>
  8. References: <4ehger$cj9@mark.ucdavis.edu> <4emlsq$odt@airdmhor.gen.nz> <pronet01.34.003B9BB5@indirect.com> <823827008snz@genesis.demon.co.uk>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <823827008snz@genesis.demon.co.uk>,
  12. Lawrence Kirby  <fred@genesis.demon.co.uk> wrote:
  13.  >In article <pronet01.34.003B9BB5@indirect.com>
  14.  >           pronet01@indirect.com "Mark Miller" writes:
  15.  >
  16.  >>move addresses for a pointer variable that you have used "free" on..
  17.  >
  18.  >As far as the C language is concerned the value of a pointer is
  19.  >indeterminate if the object it pointed to has been freed. Therefore code
  20.  >that tries to use the value of a pointer after that has been passed to
  21.  >free is plain broken (except possibly, as has been argued on comp.stc.c,
  22.  >if that value is accessed as a char array). So if a compiler can generate
  23.  >more efficient code my making use of this then that is a good compiler and
  24.  >all correct programs will continue to work with it.
  25.  
  26. ... as long as it is not hard-coded to treat identifiers like "free" specially. 
  27. If you write your own free() with different semantics, you would not want the
  28. compiler messing with that. It's just another function, after all. Some
  29. compilers have special directives that you can apply to function prototypes
  30. that give a hint to the compiler (for example, hints like "this function does
  31. not return, so you may treat client code accordingly").
  32. -- 
  33.  
  34.